.class public Lorg/microemu/cldc/file/Connection;
.super Ljava/lang/Object;
.source "Connection.java"

# interfaces
.implements Lorg/microemu/microedition/io/ConnectionImplementation;


# static fields
.field public static final CONNECTIONTYPE_SYSTEM_FS:I = 0x0

.field public static final PROTOCOL:Ljava/lang/String; = "file://"

.field private static connectionType:I


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 45
    const/4 v0, 0x0

    sput v0, Lorg/microemu/cldc/file/Connection;->connectionType:I

    return-void
.end method

.method public constructor <init>()V
    .locals 0

    .prologue
    .line 39
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method static getConnectionType()I
    .locals 1

    .prologue
    .line 61
    sget v0, Lorg/microemu/cldc/file/Connection;->connectionType:I

    return v0
.end method

.method static setConnectionType(I)V
    .locals 0
    .parameter "connectionType"

    .prologue
    .line 65
    sput p0, Lorg/microemu/cldc/file/Connection;->connectionType:I

    .line 66
    return-void
.end method


# virtual methods
.method public openConnection(Ljava/lang/String;IZ)Ljavax/microedition/io/Connection;
    .locals 4
    .parameter "name"
    .parameter "mode"
    .parameter "timeouts"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    const/4 v2, 0x0

    const-string v3, "file://"

    .line 49
    const-string v0, "file://"

    invoke-virtual {p1, v3}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_0

    .line 50
    new-instance v0, Ljava/io/IOException;

    new-instance v1, Ljava/lang/StringBuffer;

    invoke-direct {v1}, Ljava/lang/StringBuffer;-><init>()V

    const-string v2, "Invalid Protocol "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v1

    invoke-virtual {v1, p1}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 52
    :cond_0
    sget v0, Lorg/microemu/cldc/file/Connection;->connectionType:I

    packed-switch v0, :pswitch_data_0

    .line 56
    new-instance v0, Ljava/io/IOException;

    const-string v1, "Invalid connectionType configuration"

    invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 54
    :pswitch_0
    new-instance v0, Lorg/microemu/cldc/file/FileSystemFileConnection;

    const-string v1, "file://"

    invoke-virtual {v3}, Ljava/lang/String;->length()I

    move-result v1

    invoke-virtual {p1, v1}, Ljava/lang/String;->substring(I)Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v2, v1, v2}, Lorg/microemu/cldc/file/FileSystemFileConnection;-><init>(Ljava/lang/String;Ljava/lang/String;Lorg/microemu/cldc/file/FileSystemConnectorImpl;)V

    return-object v0

    .line 52
    nop

    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_0
    .end packed-switch
.end method
